<!DOCTYPE html>
<html lang="" xml:lang="">
<head>

  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <title>基于R语言的社会科学建模</title>
  <meta name="description" content="基于R语言的社会学建模。" />
  <meta name="generator" content="bookdown 0.20 and GitBook 2.6.7" />

  <meta property="og:title" content="基于R语言的社会科学建模" />
  <meta property="og:type" content="book" />
  
  
  <meta property="og:description" content="基于R语言的社会学建模。" />
  

  <meta name="twitter:card" content="summary" />
  <meta name="twitter:title" content="基于R语言的社会科学建模" />
  
  <meta name="twitter:description" content="基于R语言的社会学建模。" />
  

<meta name="author" content="陆泽凯 谢颖" />


<meta name="date" content="2020-10-21" />

  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  
  


<script src="libs/header-attrs-2.2/header-attrs.js"></script>
<script src="libs/jquery-2.2.3/jquery.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-table.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-clipboard.css" rel="stylesheet" />











<style type="text/css">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
  { counter-reset: source-line 0; }
pre.numberSource code > span
  { position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
  { content: counter(source-line);
    position: relative; left: -1em; text-align: right; vertical-align: baseline;
    border: none; display: inline-block;
    -webkit-touch-callout: none; -webkit-user-select: none;
    -khtml-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
    padding: 0 4px; width: 4em;
    color: #aaaaaa;
  }
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
div.sourceCode
  {   }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>

<link rel="stylesheet" href="style.css" type="text/css" />
</head>

<body>



  <div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">

    <div class="book-summary">
      <nav role="navigation">

<ul class="summary">
<li><a href="./">基于R语言的社会科学建模</a></li>

<li class="divider"></li>
<li class="chapter" data-level="" data-path=""><a href="#前言"><i class="fa fa-check"></i>前言</a></li>
<li class="divider"></li>
<li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li>

</ul>

      </nav>
    </div>

    <div class="book-body">
      <div class="body-inner">
        <div class="book-header" role="navigation">
          <h1>
            <i class="fa fa-circle-o-notch fa-spin"></i><a href="./">基于R语言的社会科学建模</a>
          </h1>
        </div>

        <div class="page-wrapper" tabindex="-1" role="main">
          <div class="page-inner">

            <section class="normal" id="section-">
<div id="header">
<h1 class="title">基于R语言的社会科学建模</h1>
<p class="author"><em>陆泽凯 谢颖</em></p>
<p class="date"><em>2020-10-21</em></p>
</div>
<div id="前言" class="section level1 unnumbered">
<h1>前言</h1>
<p>
  <em>没有人是一座孤岛</em>，17世纪英国诗人——约翰·多恩的诗句<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a>。在今天数据爆炸的时代更是如此。人与人之间的交流沟通在21世纪的今天变得如此频繁。无论你是否是被动还是主动，我们都必须要和别人交流，获得数据。大数据时代，社会科学工作者常会感觉到迷茫，无所适从。看到了数据背后可能隐藏的宝藏，却手里缺少称心的工具去挖掘。通过这本书，我将介绍一种极其强大的数据挖掘，数据建模工具——<code>R</code>语言。
<p>
<p>
  本书将用R语言目前最流行的语法结构——<code>tidy way</code>进行讲授。<code>tidy way</code>是R语言最著名开发者<em>Hadley Wickham</em>开发的一系列数据清洗，数据可视化的包（<code>dplyr</code>和<code>tidyr</code>以及<code>ggplot</code>等包组成）所衍生的新的<code>R</code>语言语法。这套语法使得R语言变得更易上手，任何人都可以轻松学习！
<p>
<p>
  本书主要分为两个部分——第一个部分，会通过一份社科数据向大家讲授<code>R</code>语言的基础操作，这部分会教授大家如何导入数据，清洗数据，合并数据并完成数据的初步可视化。通过这一部分，大家就可以通过各种社科数据进行基本的分析加工。
<p>
<p>
  第二个部分，我将讲一些社科量化模型，包括回归分析模型，因子模型，如何通过<code>R</code>语言做主成分分析。之后，我将教大家如何对微博进行简单的文本分析。也许你只听说过用<code>Python</code>进行机器学习。但其实利用<code>R</code>语言也可以进行机器模型的建立。这一部分的最后，我将教大家如何利用前面分析的结果，做出专业的科研绘图，满足科研杂志的需要。
<p>
<p>
  相信通过这本书，大家可以得到一份称心的工具，建立自己的定量科学武器。不再是一座数据的孤岛。
<p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true"></a><span class="kw">install.packages</span>(<span class="st">&quot;bookdown&quot;</span>)</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true"></a><span class="co"># or the development version</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true"></a><span class="co"># devtools::install_github(&quot;rstudio/bookdown&quot;)</span></span></code></pre></div>
<p>Remember each Rmd file contains one and only one chapter, and a chapter is defined by the first-level heading <code>#</code>.</p>
<p>To compile this example to PDF, you need XeLaTeX. You are recommended to install TinyTeX (which includes XeLaTeX): <a href="https://yihui.org/tinytex/" class="uri">https://yihui.org/tinytex/</a>.</p>
</div>






<div class="footnotes">
<hr />
<ol start="1">
<li id="fn1"><p>没有谁是一座孤岛，在大海里独踞；每个人都像一块小小的泥土，连接成整个陆地。——《没有人是一座孤岛》<a href="#fnref1" class="footnote-back">↩︎</a></p></li>
</ol>
</div>
            </section>

          </div>
        </div>
      </div>


    </div>
  </div>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/lunr.js"></script>
<script src="libs/gitbook-2.6.7/js/clipboard.min.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script>
<script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-clipboard.js"></script>
<script>
gitbook.require(["gitbook"], function(gitbook) {
gitbook.start({
"sharing": {
"github": false,
"facebook": true,
"twitter": true,
"linkedin": false,
"weibo": false,
"instapaper": false,
"vk": false,
"all": ["facebook", "twitter", "linkedin", "weibo", "instapaper"]
},
"fontsettings": {
"theme": "white",
"family": "sans",
"size": 2
},
"edit": {
"link": null,
"text": null
},
"history": {
"link": null,
"text": null
},
"view": {
"link": null,
"text": null
},
"download": null,
"toc": {
"collapse": "subsection"
},
"search": false
});
});
</script>

</body>

</html>
